import request from '@/utils/request'


export function fetchSingleNew(newsId) {
    return request({
        url: `/news/${newsId}`,
        method: 'get'
    })
}

export function getAllNewsByPage(pageNum,pageSize){
    return request({
        url:'/news/allByPage?pageNum='+pageNum+'&pageSize='+pageSize,
        method:'get',
        headers: {
            "Access-Control-Allow-Origin": "*"
        }
    })
}



export function uploadNew(data) {
    return request({
        url:'/news/save',
        method:'post',
        contentType:'application/json',
        data
    })
}

export function updateNews(data) {
    return request({
        url:'/news/update',
        method:'post',
        dataType:'json',
        data
    })
}


export function deleteNews(newsId){
    return request({
        url: `/news/delete/${newsId}`,
        method:'delete'
    })
}
